/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    min-height: 100vh;
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 操作栏样式 */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.search-filter {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.search-group {
    display: flex;
    position: relative;
}

#search-input {
    padding: 10px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px 0 0 8px;
    font-size: 0.95rem;
    outline: none;
    width: 250px;
    transition: border-color 0.3s;
}

#search-input:focus {
    border-color: #6a11cb;
}

.search-btn {
    padding: 10px 15px;
    background: #6a11cb;
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-btn:hover {
    background: #5a10b5;
}

.filter-group {
    display: flex;
    gap: 10px;
}

.filter-select {
    padding: 10px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.filter-select:focus {
    border-color: #6a11cb;
}

/* 按钮样式 */
.primary-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(106, 17, 203, 0.3);
}

.cancel-btn {
    padding: 10px 20px;
    background-color: #e1e5e9;
    color: #333;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.cancel-btn:hover {
    background-color: #d1d5d9;
}

.delete-btn {
    padding: 10px 20px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.delete-btn:hover {
    background-color: #c82333;
}

/* 统计卡片样式 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #6a11cb;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

/* 书籍列表样式 */
.books-section {
    margin-bottom: 30px;
}

.books-section h2 {
    margin-bottom: 20px;
    color: #6a11cb;
    font-size: 1.5rem;
}

.books-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* 空状态样式 */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.empty-state p {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

/* 书籍卡片样式 */
.book-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.book-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.book-status {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-want-read {
    background-color: #e7f3ff;
    color: #0066cc;
}

.status-reading {
    background-color: #fff3cd;
    color: #856404;
}

.status-read {
    background-color: #d4edda;
    color: #155724;
}

.book-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: #333;
}

.book-author {
    font-size: 1rem;
    color: #666;
    margin-bottom: 10px;
    font-style: italic;
}

.book-info {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
}

.book-rating {
    font-size: 1rem;
    margin-bottom: 10px;
}

.book-review {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
    flex-grow: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.book-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.edit-btn, .remove-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.edit-btn {
    background-color: #6c757d;
    color: white;
}

.edit-btn:hover {
    background-color: #5a6268;
}

.remove-btn {
    background-color: #dc3545;
    color: white;
}

.remove-btn:hover {
    background-color: #c82333;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.3s;
}

.small-modal {
    max-width: 400px;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.close-btn:hover {
    background-color: #f1f1f1;
}

/* 表单样式 */
.book-form {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #6a11cb;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 30px;
}

/* 模态框内容样式 */
.modal-body {
    padding: 20px;
}

.modal-body p {
    margin-bottom: 10px;
}

.book-to-delete {
    font-weight: 600;
    color: #6a11cb;
}

/* 提示消息样式 */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 12px 20px;
    background-color: #28a745;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1001;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    background-color: #dc3545;
}

.toast.info {
    background-color: #17a2b8;
}

/* 底部样式 */
.footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.9rem;
    margin-top: 40px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-filter {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-group {
        width: 100%;
    }
    
    #search-input {
        width: calc(100% - 50px);
    }
    
    .filter-group {
        flex-direction: column;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .primary-btn {
        width: 100%;
    }
    
    .stats-cards {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .books-container {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .toast {
        bottom: 20px;
        right: 20px;
        left: 20px;
        text-align: center;
    }
}